import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LxMaterialAuxVO, LxMaterialAuxForm, LxMaterialAuxQuery } from '@/api/lingxing/lxMaterialAux/types';

/**
 * 查询领星辅料列表
 * @param query
 * @returns {*}
 */

export const listLxMaterialAux = (query?: LxMaterialAuxQuery): AxiosPromise<LxMaterialAuxVO[]> => {
  return request({
    url: '/lingxing/lxMaterialAux/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星辅料详细
 * @param id
 */
export const getLxMaterialAux = (id: string | number): AxiosPromise<LxMaterialAuxVO> => {
  return request({
    url: '/lingxing/lxMaterialAux/' + id,
    method: 'get'
  });
};

/**
 * 新增领星辅料
 * @param data
 */
export const addLxMaterialAux = (data: LxMaterialAuxForm) => {
  return request({
    url: '/lingxing/lxMaterialAux',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星辅料
 * @param data
 */
export const updateLxMaterialAux = (data: LxMaterialAuxForm) => {
  return request({
    url: '/lingxing/lxMaterialAux',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星辅料
 * @param id
 */
export const delLxMaterialAux = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/lxMaterialAux/' + id,
    method: 'delete'
  });
};

/**
 * 同步领星
 * @returns {*}
 */
export const syncData = () => {
  return request({
    url: '/lingxing/lxMaterialAux/syncData',
    method: 'post'
  });
};

export const getNewestUpdateTime = () => {
  return request({
    url: '/lingxing/lxMaterialAux/getNewestUpdateTime',
    method: 'get'
  });
};
